<?php
/**

 * @version $Id: view.html.php,v 1.4 2009/06/04 20:13:37 dgravato Exp $

 * @package    sketchup

 * @subpackage 

 * @author     Chris Borkowski {@link http://www.guggenheim.org}

 * @author     Created on 29-May-2009

 */

// no direct access

defined( '_JEXEC' ) or die( 'Restricted access' );

jimport( 'joomla.application.component.view');

/**
 * HTML View class for the sketchup Component
 *
 * @package    sketchup
 */

class ViewAllEarth extends JView
{

	function display($tpl = null)
	{
		global $option;

		$model = &$this->getModel();
		$list = $model->getList();

		for($i = 0; $i < count($list); $i++) 
		{ 
			$row =& $list[$i]; 
			$row->link = JRoute::_('index.php?option=' . $option . '&id=' . $row->id  . '&view=project'); 
		}
				
		
		
       
		// add to header for goggle earth api, this is so messy, We should make a class in a helper file
		$js = '<script src="http://maps.google.com/jsapi?hl=en&amp;
		key=ABQIAAAAnjdnAXHgWmdtZhazDy5MfBSsBzaQV0SmPn3rDJJ7iLsgSUgMyxQUpKYQL_cSpLh_EF9qcFXTbFHJrg" 
		type="text/javascript"></script>
		 <script type="text/javascript">
google.load("earth", "1");
var ge = null;
function init() {
  google.earth.createInstance("map3d", initCallback, failureCallback);
}
function initCallback(object) {
  ge = object;
  ge.getWindow().setVisibility(true);
}
function failureCallback(object) {
}
</script>
';

        //set page title
		$document = & JFactory::getDocument();
		$document->setTitle('View Shelters');
		$document->addCustomTag($js);
		
		// make some metadata 
		$keywords = JText::_('Google Earth, Guggenehim Museum, New York, Design It Contest, Digital Art, Architecture, Sketchup');
		$document->setMetaData ('keywords', $keywords);
		
        // push data into the template
		$this->assignRef('list', $list); 
		parent::display($tpl);	
	}

} 

?>